package com.example.qwe.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.qwe.entity.Students;
import com.example.qwe.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class StudentService {
@Autowired
    StudentMapper studentMapper;

   public Students findById(Integer id){
       return studentMapper.selectById(id);
   }

   public void insertId(Students students){
       studentMapper.insert(students);
   }

   public void deleteById(Integer id){
       studentMapper.deleteById(id);
   }

   public void update(Students students){
         studentMapper.updateById(students);
   }

   public List<Students> findIdBetween(Integer left,Integer right){
       QueryWrapper<Students> queryWrapper=new QueryWrapper<>();
       queryWrapper.between("id",left,right);
       return studentMapper.selectList(queryWrapper);
   }

}
